package com.entity.table;

import com.mybatisflex.core.query.QueryColumn;
import com.mybatisflex.core.table.TableDef;


/**
 * 购物车商品表 表定义层。
 *
 * @author admin
 * @since 2024-06-05
 */
public class FCartGoodsTableDef extends TableDef {

    private static final long serialVersionUID = 1L;

    /**
     * 购物车商品表
     */
    public static final FCartGoodsTableDef F_CART_GOODS = new FCartGoodsTableDef();

    /**
     * 索引
     */
    public final QueryColumn ID = new QueryColumn(this, "id");

    /**
     * 商品数量
     */
    public final QueryColumn NUM = new QueryColumn(this, "num");

    /**
     * 购物车id
     */
    public final QueryColumn CART_ID = new QueryColumn(this, "cart_id");

    /**
     * 商品id
     */
    public final QueryColumn GOODS_ID = new QueryColumn(this, "goods_id");

    /**
     * 所有字段。
     */
    public final QueryColumn ALL_COLUMNS = new QueryColumn(this, "*");

    /**
     * 默认字段，不包含逻辑删除或者 large 等字段。
     */
    public final QueryColumn[] DEFAULT_COLUMNS = new QueryColumn[]{ID, CART_ID, GOODS_ID, NUM};

    public FCartGoodsTableDef() {
        super("", "f_cart_goods");
    }

    private FCartGoodsTableDef(String schema, String name, String alisa) {
        super(schema, name, alisa);
    }

    public FCartGoodsTableDef as(String alias) {
        String key = getNameWithSchema() + "." + alias;
        return getCache(key, k -> new FCartGoodsTableDef("", "f_cart_goods", alias));
    }

}
